using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.DependencyInjection;

namespace XjjXmm.Infrastructure.Webs.ActionResult;

public class StreamResult: Microsoft.AspNetCore.Mvc.ActionResult
{
    public override Task ExecuteResultAsync(ActionContext context)
    {
        if (context == null)
        {
            throw new ArgumentNullException(nameof(context));
        }

        var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<StreamResult>>();
        return executor.ExecuteAsync(context, this);
    }
}